﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:MinecraftGPS.Controls"
    x:Class="MinecraftGPS.MainWindow"
    Title="Minecraft GPS" 
    ResizeMode="NoResize" 
    SizeToContent="WidthAndHeight" 
    Icon="Compass.ico" 
    Topmost="True" 
    AllowsTransparency="True" 
    WindowStyle="None" 
    Background="{x:Null}" 
    Foreground="{DynamicResource TextBrush}"
>
    <Window.Resources>
        <Style x:Key="HeaderLabel" TargetType="{x:Type Label}">
            <Setter Property="Foreground" Value="#FF00AAFF"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Padding" Value="5"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Label}">
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ItemLabel" TargetType="{x:Type Label}">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Padding" Value="5"/>
            <Setter Property="HorizontalContentAlignment" Value="Right"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Margin" Value="8,2,2,2" />
            <Setter Property="Width" Value="40" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Label}">
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <SolidColorBrush x:Key="GroupHeaderBrush" Color="#FFFFAA00"/>
    </Window.Resources>

    <controls:ClippingBorder CornerRadius="10" BorderThickness="1" SnapsToDevicePixels="True" BorderBrush="{DynamicResource ToolBarGripper}" Background="{DynamicResource WindowBackgroundBrush}">
        <DockPanel>                
            <Grid DockPanel.Dock="Top" Background="{DynamicResource ControlBackgroundBrush}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                    
                <Menu Grid.Column="0" VerticalAlignment="Center" Margin="2">
                    <MenuItem Header="World">
                        <MenuItem x:Name="world1MenuItem" Header="World 1" />
                        <MenuItem x:Name="world2MenuItem" Header="World 2" />
                        <MenuItem x:Name="world3MenuItem" Header="World 3" />
                        <MenuItem x:Name="world4MenuItem" Header="World 4" />
                        <MenuItem x:Name="world5MenuItem" Header="World 5" />
                        <Separator />
                        <MenuItem x:Name="otherWorldMenuItem" Header="Other..." />
                    </MenuItem>
                    <MenuItem Header="View">
                        <MenuItem x:Name="standardMenuItem" Header="Standard" IsChecked="True" />
                        <MenuItem x:Name="compactMenuItem" Header="Compact" />
                        <Separator />
                        <MenuItem x:Name="relativeCoordinatesMenuItem" Header="Relative Coordinates" IsChecked="True" />
                        <MenuItem x:Name="compassCoordinatesMenuItem" Header="Compass Coordinates" />
                        <Separator />
                        <MenuItem x:Name="opacity100MenuItem" Header="Opacity 100%" IsChecked="True" />
                        <MenuItem x:Name="opacity75MenuItem" Header="Opacity 75%" />
                        <MenuItem x:Name="opacity50MenuItem" Header="Opacity 50%" />
                        <MenuItem x:Name="opacity25MenuItem" Header="Opacity 25%" />
                    </MenuItem>
                </Menu>
                <Button x:Name="dragButton" Grid.Column="1" Template="{DynamicResource DragButtonTemplate}" />
                <Button x:Name="closeButton" Grid.Column="2" Content="X" Template="{DynamicResource CloseButtonTemplate}" Foreground="Red" Width="18" Height="18" Margin="4,5" />
            </Grid>
                    
            <StatusBar VerticalAlignment="Top" DockPanel.Dock="Bottom">
                <StatusBarItem x:Name="status" Background="Transparent" Content="MinecraftGPS" Margin="4,0" />
            </StatusBar>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <GroupBox Grid.Column="0" Grid.Row="0" Header="Player" Margin="2" Foreground="{DynamicResource GroupHeaderBrush}" FontWeight="Bold">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Label Grid.Column="0" Grid.Row="0" Content="NS" Style="{DynamicResource HeaderLabel}" />
                        <Label Grid.Column="0" Grid.Row="1" Content="EW" Style="{DynamicResource HeaderLabel}" />
                        <Label Grid.Column="0" Grid.Row="2" Content="Alt" Style="{DynamicResource HeaderLabel}" />

                        <Label x:Name="posX" Grid.Column="1" Grid.Row="0" IsEnabled="False" Style="{DynamicResource ItemLabel}" />
                        <Label x:Name="posZ" Grid.Column="1" Grid.Row="1" IsEnabled="False" Style="{DynamicResource ItemLabel}" />
                        <Label x:Name="posY" Grid.Column="1" Grid.Row="2" IsEnabled="False" Style="{DynamicResource ItemLabel}" />
                    </Grid>
                </GroupBox>

                <GroupBox Grid.Column="1" Grid.Row="0" Header="Chunk" VerticalAlignment="Top" Margin="2" Foreground="{DynamicResource GroupHeaderBrush}" FontWeight="Bold">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Label Grid.Column="0" Grid.Row="0" Content="X" Style="{DynamicResource HeaderLabel}" />
                        <Label Grid.Column="0" Grid.Row="1" Content="Z" Style="{DynamicResource HeaderLabel}" />

                        <Label x:Name="chunkX" Grid.Column="1" Grid.Row="0" Style="{DynamicResource ItemLabel}" />
                        <Label x:Name="chunkZ" Grid.Column="1" Grid.Row="1" Style="{DynamicResource ItemLabel}" />
                    </Grid>
                </GroupBox>

                <Grid x:Name="relativeGrid" Grid.Column="2" Grid.Row="0">
                    <GroupBox x:Name="relativeGroup" Header="Relative" Margin="2" FontWeight="Bold" Foreground="{DynamicResource GroupHeaderBrush}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <Label Grid.Column="0" Grid.Row="0" Content="NS" Style="{DynamicResource HeaderLabel}" />
                            <Label Grid.Column="0" Grid.Row="1" Content="EW" Style="{DynamicResource HeaderLabel}" />
                            <Label Grid.Column="0" Grid.Row="2" Content="Alt" Style="{DynamicResource HeaderLabel}" />

                            <Label x:Name="relativeX" Grid.Column="1" Grid.Row="0" Style="{DynamicResource ItemLabel}" />
                            <Label x:Name="relativeZ" Grid.Column="1" Grid.Row="1" Style="{DynamicResource ItemLabel}" />
                            <Label x:Name="relativeY" Grid.Column="1" Grid.Row="2" Style="{DynamicResource ItemLabel}" />
                        </Grid>
                    </GroupBox>
                        
                    <Grid x:Name="compass" Visibility="Hidden">
                        <Canvas Width="90" Height="90">
                            <Ellipse Stroke="Lime" Width="70" Height="70" Canvas.Left="10" Canvas.Top="10" />
                            <Line Stroke="Lime" Y1="0" Y2="10" X1="45" X2="45" />
                        </Canvas>

                        <Canvas x:Name="compassPoints" Width="90" Height="90" RenderTransformOrigin="0.5,0.5">
                        	<Canvas.RenderTransform>
                        		<TransformGroup>
                        			<RotateTransform x:Name="compassRotation" />
                        		</TransformGroup>
                        	</Canvas.RenderTransform>
                            <Line Stroke="Lime" X1="10" X2="80" Y1="45" Y2="45" />
                            <Line Stroke="Lime" Y1="10" Y2="80" X1="45" X2="45" />
                            <TextBlock Text="N" Canvas.Left="41" Canvas.Top="-3" />
                            <TextBlock Text="S" Canvas.Left="43" Canvas.Top="76" />
                            <TextBlock Text="E" Canvas.Left="80" Canvas.Top="37" />
                            <TextBlock Text="W" Canvas.Left="0" Canvas.Top="37" />
                        </Canvas>
                        <Canvas x:Name="waypoint" Width="90" Height="90" RenderTransformOrigin="0.5,0.5" Visibility="Hidden">
                        	<Canvas.RenderTransform>
                        		<TransformGroup>
                        			<RotateTransform x:Name="waypointRotation" />
                        		</TransformGroup>
                        	</Canvas.RenderTransform>
                            <Line Stroke="White" X1="45" X2="45" Y1="10" Y2="45" StrokeThickness="3" />
                        </Canvas>
                        <Border x:Name="distanceBorder" HorizontalAlignment="Center" VerticalAlignment="Center" Background="Black" BorderBrush="Lime" BorderThickness="1" Visibility="Hidden">
                            <TextBlock x:Name="distanceText" Text="0" Foreground="Yellow" />
                        </Border>
                        <Canvas x:Name="waypointPitch" Width="90" Height="90" RenderTransformOrigin="0.5,0.5" Visibility="Hidden" Opacity="0.75">
                            <Canvas.RenderTransform>
                                <TransformGroup>
                                    <TranslateTransform x:Name="waypointPitchTranslation" />
                                </TransformGroup>
                            </Canvas.RenderTransform>
                            <Line Stroke="White" StrokeThickness="3" X1="35" X2="55" Y1="45" Y2="45" />
                        </Canvas>
                    </Grid>
                </Grid>

                <ListBox x:Name="bookmarkListBox" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="4" MaxHeight="68" />

                <StackPanel x:Name="bookmarkButtons" Grid.Column="2" Grid.Row="1">
                    <Button x:Name="addBookmark" Content="Add" IsEnabled="False" Margin="4" />
                    <Button x:Name="deleteBookmark" Content="Delete" IsEnabled="False" Margin="4" />
                    <Button x:Name="editBookmark" Content="Edit" IsEnabled="False" Margin="4" />
                </StackPanel>
            </Grid>
        </DockPanel>
    </controls:ClippingBorder>
</Window>
